Refactor "_get_next" to not use recursion#6
Conversation
There was a problem hiding this comment.
Pull request overview
Refactors Flow._get_next to avoid recursion (improving performance and preventing deep-recursion overhead) while preserving task-selection behavior across chained and composite workflows.
Changes:
- Replaced recursive
_get_nexttraversal with an explicit stack-based (iterative) traversal. - Added a dedicated test module covering
_get_nextbehavior across simple chains and composite task scenarios.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
taskflow/flow.py |
Converts _get_next from recursive traversal to an iterative stack-based traversal using deque. |
taskflow/test/test_flow_get_next.py |
Adds expanded test coverage for _get_next across many state combinations and workflow shapes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
comment updates Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@georgistanev I've opened a new pull request, #7, to work on those changes. Once the pull request is ready, I'll request review from you. |
The recursive method was quite slow with large workflows. This PR tries to change to an iterative approach without changing the functionality.
Version bumped so dependents can reference the new version of the library.